<?php
//pr($user);
	$authedUser = $session->read('Auth.User');
	$ownProfile = false;
	if($user['User']['id']== $authedUser['id'])
	{
		$ownProfile = true;
	}
?>
<!-- recipe profile code starts here. -->
<?php if(!empty($user))
{?>
<div class="container">
	<div class="row">
		<h2><?php echo ($user['User']['username']); ?>'s Profile</h2>
		<div class="wrap_all_form box_profile">      
			<div class="padd_inner">
				<div class="w_avata_info">
					<?php echo $html->image($user['User']['avatar'],array('thumb'=>array('crop'=>true,'width'=>80,'height'=>80), 'class'=>'avata'));?>
					<div class="user_info">
						  <?php echo __('Registration Date')?> : <?php echo date('Y-m-d',strtotime($user['User']['created']));?> <br>
						  <?php echo __('Last Login Date')?> : <?php echo date('Y-m-d',strtotime($user['User']['last_login_date']));?><br>
					</div> 
				</div><!--w_avata_info-->	
				<div class="profile_stats"> 	
					<?php if($ownProfile == false)
				{?>
					<i class="fa fa-file"> </i><?php echo $html->link(sprintf(__('%s Listings submitted'),$user['User']['listing_count']),$user['User']['profile_links']['listings'],array('class'=>'listing_add'))?><br>
					<i class="fa fa-star"> </i><?php echo $html->link(sprintf(__('%s Reviews submitted'),$user['User']['review_count']),$user['User']['profile_links']['reviews'],array('class'=>'review_star'))?> <br>
					<i class="fa fa-heart"> </i><?php echo $html->link(sprintf(__('%s Favorite Listings'),$user['User']['fav_listing_count']),$user['User']['profile_links']['favorites'],array('class'=>'favriotes'))?><br>
					<i class="fa fa-camera-retro"> </i><?php echo $html->link(sprintf(__('%s Listing Images'),$user['User']['listing_asset_count']),$user['User']['profile_links']['userGallery'],array('class'=>'image_add'))?>	<br>
				<?php }else{?>
					<i class="fa fa-file"> </i><?php echo $html->link(sprintf(__('%s Listings submitted'),$user['User']['listing_count']),SiteUrl::getUrl('myListings'),array('class'=>'listing_add'))?><br>
					<i class="fa fa-star"> </i><?php echo $html->link(sprintf(__('%s Reviews submitted'),$user['User']['review_count']),SiteUrl::getUrl('myReviews'),array('class'=>'review_star'))?><br>
					<i class="fa fa-heart"> </i><?php echo $html->link(sprintf(__('%s Favorite Listings'),$user['User']['fav_listing_count']),SiteUrl::getUrl('myFavorites'),array('class'=>'favriotes'))?><br>
					<i class="fa fa-camera-retro"> </i><?php echo $html->link(sprintf(__('%s Listing Images'),$user['User']['listing_asset_count']),SiteUrl::getUrl('myGallery'),array('class'=>'image_add'))?><br>
                    <?php if(AppUtility::allowPaidListing() && cri("PaidListings.ListingPlan")->hasAnyListing($session->read("Auth.User.id"))){?>		
                        <?php echo $html->link(__("My Orders"),"/paid_listings/orders/my",array('class'=>'my_orders'))?>
                    <?php } ?>
                    
                    <?php 
                    if(cr("DealConfig.enable_deals"))
                    {
                    	echo '<i class="fa fa-tags"> </i>'.$html->link(__('My posted deals'),$html->url(array("plugin"=>"deals","controller"=>"deals","action"=>"myDeals"), true),array('class'=>'my_deals')).'<br>';
                    	echo '<i class=" fa fa-certificate "> </i>'.$html->link(__('My purchased deals'),$html->url(array("plugin"=>"deals","controller"=>"deal_orders","action"=>"myDeals"), true),array('class'=>'purchased_deal')).'<br>';
                    }
                    if(cr("EventConfig.enable_events"))
                    {
                    	echo '<i class="fa fa-calendar"> </i>'.$html->link(__('My posted events'),$html->url(array("plugin"=>"events","controller"=>"events","action"=>"my"), true),array('class'=>'my_events')).'<br>';
                    }
                    ?>
                <?php }?>	
				</div><!--profile_stats--> 
				<div class="w_bnt">
					<?php if($ownProfile)
					{?>
						<?php echo $html->link(__('Edit Profile'),('/users/editProfile'),array('class'=>'bt_submit bt_EditProfile'));?>		
								
					<?php }elseif(!empty($authedUser)){
					?>
						<?php echo $html->link(__('Send message'),'/messages/send/'.$user['User']['id'].'/User',array('class'=>'action_link')).'<br />';?>
					<?php }?>
				</div><!--w_bnt-->
				
			</div><!--padd_inner -->
		</div><!--/.wrap_all_form-->
	
	</div>
</div>
<?php }?>
<!-- recipe profile code ends here. -->